from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import Photo, Gallery

class PhotoAdmin(admin.ModelAdmin):
	fieldsets = ((None, {'fields': ('site', 'user', 'image', 'title', 'slug', 
				'photographer', 'caption',)}),
		(_(u'Tagging'), {'fields': ('tags',),}),
	    (_(u'Date information'), {'fields': ('pub_date',), 
        	'classes': 'collapse'}),
	    (_(u'Settings'), {'fields': ('publication_status',)}),)
	list_display = ('title', 'pub_date', 'site', 'user', 'image', 
		'photographer', 'publication_status',)
	list_filter = ('pub_date', 'site', 'user', 'photographer', 
		'publication_status',)
	search_fields = ['title']
	date_hierarchy = 'pub_date'
	prepopulated_fields = {'slug': ('title',)}
	radio_fields = {'publication_status': True}
	
class GalleryAdmin(admin.ModelAdmin):
	fieldsets = ((None, {'fields': ('site', 'title', 'slug', 'description',
				'photos',)}),
			 (_(u'Date information'), {'fields': ('pub_date',), 
				'classes': 'collapse'}),)
	list_display = ('title', 'pub_date', 'site', 'slug',)
	list_filter = ('pub_date', 'site',)
	search_fields = ['title']
	date_hierarchy = 'pub_date'
	prepopulated_fields = {'slug': ('title',)}

admin.site.register(Gallery, GalleryAdmin)
admin.site.register(Photo, PhotoAdmin)